package com.zhentao.controller;

import com.zhentao.comm.Result;
import com.zhentao.pojo.Admin;
import com.zhentao.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin")
public class AdminController {

    @Autowired
    private AdminService service;

    /**
     * 管理端登录
     * @param admin
     * @return
     */
        @RequestMapping("login")
    public Result<Admin> Login(@RequestBody Admin admin){
        Admin login = service.Login(admin);
        if(login!=null){
            // 登录成功
            return Result.success("登录成功");
        }

        return Result.error("登录失败");
    }








}
